package view;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class ImagePanel extends JPanel{

    /**
	 * 
	 */
	private static final long serialVersionUID = -430370560681089061L;
	
	private BufferedImage image = null;

    public ImagePanel() {
       
    }
    
    public void setImage(URL url) {
    	try {                
            image = ImageIO.read(url);
            
         } catch (IOException ex) {
         }
	}

    @Override
    public void paintComponent(Graphics g) {
    	int height = this.getSize().height;
    	int width = this.getSize().width;      
        g.drawImage(image, 0, 0, width, height, this); // see javadoc for more info on the parameters

    }

}
